<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="buscar_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexCartorio.xhtml')}" value="Cartório" update="@form" immediate="true"/> >
                    <p:commandLink  value="Pesquisar Cartório" update="@form" immediate="true"/>
                </div>
                <p:panel header="Pesquisar Cartorio">
                    <p:messages showDetail="true"  id="msg" /> 
                    <fieldset>
                        <legend>Entre com os Dados</legend>    
                        <h:panelGrid columns="3"  border="0" styleClass="textAlignRight" columnClasses="textAlignRight"> 
                            <h:outputText value="Nome Cartório:"/>
                            <p:inputText value="#{managerVisualizarCartorio.cartorio.nome}" size="50" />

                        </h:panelGrid>    

                    </fieldset>
                        <div class="buttonAction">
                            <p:commandButton  icon="ui-icon-search" value="Pesquisar" actionListener="#{managerVisualizarCartorio.buscar()}" update="@form, cartorioTable, msg"/>
                            <p:commandButton icon="ui-icon-arrowreturnthick-1-w" value="Voltar" actionListener="#{managerTitulo.redirect('indexCartorio.xhtml')}" update="@form"/> 
                        </div>
                    <p:dataTable id="cartorioTable" var="cartorio" value="#{managerVisualizarCartorio.cartorios}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15">     
                        <f:facet name="header">  
                            Dados Cartório
                        </f:facet>
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Nome
                            </f:facet>  
                            <h:outputText value="#{cartorio.nome}" />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Fantasia
                            </f:facet>  
                            <h:outputText value="#{cartorio.fantasia}" />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Contato
                            </f:facet>  
                            <h:outputText value="#{cartorio.endereco.telefone}" />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Titular
                            </f:facet>  
                            <h:outputText value="#{cartorio.titular.nome}" />  
                        </p:column>
                        <p:column style="width:80px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar"  actionListener="#{managerEditarCartorio.redirect('editarCartorio.xhtml', cartorio)}" update="@form"/> 
                            <p:commandButton  icon="view" actionListener="#{managerVisualizarCartorio.redirect('visualizarCartorio.xhtml', cartorio)}" update="@form"/>   

                        </p:column>  

                    </p:dataTable>  

                </p:panel>
                <br/>
            </h:form>
        </ui:define>
    </ui:composition>
</html>